Unit Rap_TeknikServisUcretRaporu;

Interface

Uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, wwdbdatetimepicker, DB, ADODB, Grids, Wwdbigrd,
  Wwdbgrid, Buttons, ExtCtrls, wwdblook;

Type
  TRap_TeknikServisUcretRaporuF = Class(TForm)
    ListeQ: TADOQuery;
    ListeQS: TDataSource;
    Panel1: TPanel;
    Label15: TLabel;
    basTar: TwwDBDateTimePicker;
    BitTar: TwwDBDateTimePicker;
    Label14: TLabel;
    Panel2: TPanel;
    blistele: TBitBtn;
    wwDBGrid1: TwwDBGrid;
    bkapat: TBitBtn;
    toplamk: TStaticText;
    Toplam: TLabel;
    Tekniktipi: TADOQuery;
    TekniktipiS: TDataSource;
    tipi: TwwDBLookupCombo;
    Label5: TLabel;
    Procedure FormClose(Sender: TObject; Var Action: TCloseAction);
    Procedure blisteleClick(Sender: TObject);
    Procedure FormShow(Sender: TObject);
    Procedure bkapatClick(Sender: TObject);
  Private
    { Private declarations }
  Public
    { Public declarations }
  End;

Var
  Rap_TeknikServisUcretRaporuF: TRap_TeknikServisUcretRaporuF;

Implementation
Uses data;
{$R *.dfm}

Procedure TRap_TeknikServisUcretRaporuF.FormClose(Sender: TObject;
  Var Action: TCloseAction);
Begin
  Action := CaFree;
  Rap_TeknikServisUcretRaporuF := Nil;
End;

Procedure TRap_TeknikServisUcretRaporuF.blisteleClick(Sender: TObject);
Var
  toplam: real;
Begin
  ListeQ.close;
  ListeQ.SQL.Text := 'select isnull(sum(toplamhizmet),0) as toplamhizmet,isnull(sum(parcabedeli),0) as parcabedeli,isnull(sum(toplamparca),0) as toplamparca from teknik';
  ListeQ.SQL.add('where onaydurum=4 and tarih>=' + #39 + bastar.Text + #39 + 'and tarih<' + #39 + datetostr(Bittar.Date + 1) + #39);
  If tipi.Value <> '' Then
    ListeQ.SQL.add(' and tipi=' + tipi.LookupValue);

  ListeQ.open;

  Toplam := ListeQ.FieldByName('toplamhizmet').asfloat + ListeQ.FieldByName('parcabedeli').asfloat + ListeQ.FieldByName('toplamparca').asfloat;
  toplamk.Caption := FormatCurr('#,##0.## $', Toplam);

  tbcdfield(ListeQ.FieldByName('toplamhizmet')).displayformat := '#,##0.## $';
  tbcdfield(ListeQ.FieldByName('parcabedeli')).displayformat := '#,##0.## $';
  tbcdfield(ListeQ.FieldByName('toplamparca')).displayformat := '#,##0.## $';
End;

Procedure TRap_TeknikServisUcretRaporuF.FormShow(Sender: TObject);
Begin
  Tekniktipi.open;
  BasTar.Date := SadeceTarih - 30;
  BitTar.Date := SadeceTarih;
End;

Procedure TRap_TeknikServisUcretRaporuF.bkapatClick(Sender: TObject);
Begin
  close;
End;

End.
